From: ach61@labyrinth.cl.cam.ac.uk Date: Tue, 20 Apr 2004 22:06:49 +0000 (+0000) Subject: bitkeeper revision 1.869 (40859ef9aFFaEpjd21oxJfT1ZpI7MQ) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~18252 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=73ae8b1ddbb93a6542e5c9378ed607244c38758f;p=xen.git bitkeeper revision 1.869 (40859ef9aFFaEpjd21oxJfT1ZpI7MQ) domain = -2 for most recently created domain --- diff --git a/xen/arch/i386/pdb-stub.c b/xen/arch/i386/pdb-stub.c index 05e79dd31f..049f330cf6 100644 --- a/xen/arch/i386/pdb-stub.c +++ b/xen/arch/i386/pdb-stub.c @@ -344,7 +344,21 @@ pdb_process_command (char *ptr, struct pt_regs *regs, unsigned long cr3, { struct task_struct *p; - p = find_domain_by_id(pdb_ctx.domain); + if (pdb_ctx.domain == -2) + { + p = find_last_domain(); + } + else + { + p = find_domain_by_id(pdb_ctx.domain); + } + if (p == NULL) + { + printk ("pdb error: unknown domain [0x%x]\n", pdb_ctx.domain); + strcpy (pdb_out_buffer, "E01"); + pdb_ctx.domain = -1; + goto exit; + } if (p->mm.shadow_mode) pdb_ctx.ptbr = pagetable_val(p->mm.shadow_table); else @@ -357,6 +371,14 @@ pdb_process_command (char *ptr, struct pt_regs *regs, unsigned long cr3, unsigned long domain_ptbr; p = find_domain_by_id(pdb_ctx.domain); + if (p == NULL) + { + printk ("pdb error: unknown domain [0x%x][0x%x]\n", + pdb_ctx.domain, pdb_ctx.process); + strcpy (pdb_out_buffer, "E01"); + pdb_ctx.domain = -1; + goto exit; + } if (p->mm.shadow_mode) domain_ptbr = pagetable_val(p->mm.shadow_table); else @@ -364,7 +386,7 @@ pdb_process_command (char *ptr, struct pt_regs *regs, unsigned long cr3, put_task_struct(p); pdb_ctx.ptbr = domain_ptbr; - /* pdb_ctx.ptbr = pdb_linux_pid_ptbr(domain_ptbr, pdb_ctx.process); */ + /*pdb_ctx.ptbr=pdb_linux_pid_ptbr(domain_ptbr, pdb_ctx.process);*/ } pdb_ctx.valid = 0; @@ -634,6 +656,7 @@ pdb_process_command (char *ptr, struct pt_regs *regs, unsigned long cr3, } } +exit: /* reply to the request */ pdb_put_packet (pdb_out_buffer, ack); diff --git a/xen/common/domain.c b/xen/common/domain.c index 053dfecef4..87b4d19aa0 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -60,6 +60,7 @@ struct task_struct *do_createdomain(domid_t dom_id, unsigned int cpu) p->domain = dom_id; p->processor = cpu; + p->create_time = NOW(); memcpy(&p->thread, &idle0_task.thread, sizeof(p->thread)); @@ -141,6 +142,28 @@ struct task_struct *find_domain_by_id(domid_t dom) } +/* return the most recent domain created */ +struct task_struct *find_last_domain(void) +{ + struct task_struct *p, *plast; + unsigned long flags; + + read_lock_irqsave(&tasklist_lock, flags); + plast = task_list; + p = plast->next_list; + while ( p != NULL ) + { + if ( p->create_time > plast->create_time ) + plast = p; + p = p->next_list; + } + get_task_struct(plast); + read_unlock_irqrestore(&tasklist_lock, flags); + + return plast; +} + + void kill_domain_with_errmsg(const char *err) { printk("DOM%llu FATAL ERROR: %s\n", current->domain, err); diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index fcccf3fa23..14f4019ac1 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -150,6 +150,7 @@ struct task_struct mm_segment_t addr_limit; char name[MAX_DOMAIN_NAME]; + s_time_t create_time; struct thread_struct thread; struct task_struct *next_list, *next_hash; @@ -239,6 +240,7 @@ extern int construct_dom0(struct task_struct *p, extern int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *); struct task_struct *find_domain_by_id(domid_t dom); +struct task_struct *find_last_domain(void); extern void release_task(struct task_struct *); extern void __kill_domain(struct task_struct *p); extern void kill_domain(void);